package Test;




public class 删除排序链表中的重复元素 {
    public ListNode deleteDuplicates (ListNode head) {
        ListNode nxt=head.next;
        if(head.val==nxt.val){
            while (nxt!=null&&head.val==nxt.val){
                nxt=nxt.next;
            }
            head.next=deleteDuplicates(nxt);
        }else {
            head.next=deleteDuplicates(nxt);
        }
        return head;
    }
}
